import {Base} from "../../utils/base.js";
class Category extends Base{
   constructor(){
      super();
   }
   //获取分类首页的数据
   getCategoryData(callback){
      var params = {
         url:'category/all',
         scallback:function(res){
            callback&&callback(res);
         }
      }
      this.request(params);
   }
   getProductsByCategory(id, callback){
      var params = {
         url: 'product/by_category?id='+id,
         scallback:function(res){
            callback&&callback(res);
         }
      }
      this.request(params);
   }
   // 获取点击事件中的data-xxx的数据
   getDataSet(event, key) {
      return event.currentTarget.dataset[key];
   }
}
export {Category};